<template>
  <div id="app">
   
    <router-view/>
  </div>
</template>

 
<script>
// 入口组件
export default {
  name: 'App',
  created() {
    // 在页面加载时读取sessionStorage里的状态信息
    if (sessionStorage.getItem('store')) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem('store'))
        )
      )
      
      sessionStorage.setItem('store', "");
    }
 
    // 在页面刷新时将vuex里的信息保存到sessionStorage里
    // beforeunload事件在页面刷新时先触发
    window.addEventListener('beforeunload', () => {
        sessionStorage.setItem('store', JSON.stringify(this.$store.state))
    })
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
html,body{
  height: 100%;
      margin: 0px;
      background-color: #f7f7f7;
}

.van-dialog__header {
    padding: 24px 26px !important;
    font-weight: 500 !important;
    line-height: 24px !important;
    text-align: left !important;
    font-size: 18px !important;
}
.van-dialog__message {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    max-height: 60vh;
    padding: 26px 24px;
    padding-top: 0px;
    overflow-y: auto;
    font-size: 16px !important;
    line-height: 24px !important;
    white-space: pre-wrap;
    text-align: left !important;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch;
}

.van-dialog{
  border-radius: 5px !important;
}
</style>
